Skip to content

Conversation

@staskus
Copy link
Contributor

@staskus staskus commented Sep 17, 2025

Part of WOOMOB-935
Continuation of #16132

Description

Continue with UI components that need to be addressed to be able to move POS code into a separate module:

  • FormattableAmountTextField which has a dependency on a view model and a lot of business logic. I used the same pattern as with the support view, moving the implementation into an adaptor outside the POS and providing a type-erased version via the environment.
  • Coupon Creation same as with the amount text field. It's the whole feature of the Woo app that is reused on POS. Moving the logic outside the POS and accessing via the environment. Within the POS module previews, the empty implementation will be used.
  • ProductImageThumbnail moved to WooFoundation with other UI components

Steps to reproduce

  • Test Cash Payments on POS (Use 18.5 for testing since 26.0 shows a small digital keyboard that we haven't resolved yet)
  • Test Coupon Creation and Discount Type Selection on POS
  • Confirm product images on Woo app and POS continue to be displayed

Testing information

Tested on iPad Air 18.5 Simulator

Screenshots

Cash

Cash.Payment.iOS.18.Formattable.Text.Field.mov

Coupon Creation

Coupons.POS.Modularization.mov

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@staskus staskus added this to the 23.3 milestone Sep 17, 2025
@staskus staskus added type: task An internally driven task. feature: POS labels Sep 17, 2025
@dangermattic
Copy link
Collaborator

dangermattic commented Sep 17, 2025

3 Warnings
⚠️ Modules/Package.swift was changed without updating its corresponding Package.resolved. Please resolve the Swift packages as appropriate to your project setup (e.g. in Xcode or by running swift package resolve).
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
⚠️ This PR is assigned to the milestone 23.3. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 17, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr16134-cbe632f
Version23.2
Bundle IDcom.automattic.alpha.woocommerce
Commitcbe632f
Installation URL18te8i7uqh72o
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

…d adaptor

Provide access to FormattableAmountTextField and ViewModel for POS without making it as an explicit type dependency. FormattableAmountTextField cannot be easily moved and reused in a shared module due to multiple dependencies. This is used as a workaround to enable POS modularization without requiring a larger refactoring effort.
…aptor layer

Coupon and Discount creation views belong to the Woo app target and contain a lot of Woo app dependencies that are hard to refactor.

As a workaround, move the sheet creator to the adaptor layer and access type erased views through externalViews environment to build POSCouponCreationSheet.
@staskus staskus force-pushed the woomob-935-woo-pos-hack-week-pos-modularization-shared-ui-components branch from b0ee9be to 68b32d6 Compare September 17, 2025 07:14
Base automatically changed from woomob-935-woo-pos-hack-week-pos-modularization-progress-so-far-trunk to trunk September 17, 2025 10:14
@staskus staskus requested a review from jaclync September 17, 2025 10:15
@staskus
Copy link
Contributor Author

staskus commented Sep 17, 2025

@jaclync, as far as I detected, Coupons and FormattableAmountTextField should be the last two "complex" views that have to be reused this way on POS for now. externalViews will act as a possible point where we may want to refactor to have truly independent POS UI-wise. In the PointOfSale module previews, we will see empty views for cash payment text field or for coupons add action for now.

Copy link
Contributor

@jaclync jaclync left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for keeping the PR small for easier review & testing.

I just noticed one image loading issue, but I don't think it's from the PR (it's reproducible from another branch as well, before the other refactoring PR was merged). It only happens in one iOS 18.4 iPad A16 simulator (built from Xcode 26), and I suspect it's a simulator issue.

POS coupon creation app coupon creation order creation
Simulator Screenshot - iPad (A16) - 2025-09-18 at 10 07 20 Simulator Screenshot - iPad (A16) - 2025-09-18 at 10 07 53 Simulator Screenshot - iPad (A16) - 2025-09-18 at 10 33 40

as far as I detected, Coupons and FormattableAmountTextField should be the last two "complex" views that have to be reused this way on POS for now.
externalViews will act as a possible point where we may want to refactor to have truly independent POS UI-wise. In the PointOfSale module previews, we will see empty views for cash payment text field or for coupons add action for now.

Nice! And looks good to reuse this way for now. I foresee some refactoring in POS coupons if we plan to support coupons in Local Catalog i2 anyway.

@jaclync
Copy link
Contributor

jaclync commented Sep 18, 2025

Also, feel free to let me know if I can help with any remaining tasks in WOOMOB-935 that you hadn't started.

@staskus
Copy link
Contributor Author

staskus commented Sep 18, 2025

@jaclync thank you!

Also, feel free to let me know if I can help with any remaining tasks in WOOMOB-935 that you hadn't started.

Yes, definitely! I'm on SR so I cannot progress much more this week.

Co-authored-by: Jaclyn Chen <[email protected]>
@staskus
Copy link
Contributor Author

staskus commented Sep 18, 2025

I just noticed one image loading issue, but I don't think it's from the PR (it's reproducible from another branch as well, before the other refactoring PR was merged). It only happens in one iOS 18.4 iPad A16 simulator (built from Xcode 26), and I suspect it's a simulator issue.

Interesting 🤔

I tested on iPad A16 18.5 and images work, so it really may have been only 18.4 issue:

image

@staskus staskus merged commit 0d38dd7 into trunk Sep 18, 2025
13 checks passed
@staskus staskus deleted the woomob-935-woo-pos-hack-week-pos-modularization-shared-ui-components branch September 18, 2025 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: POS type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants